<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>后台登录</title>
</head>
<link rel="stylesheet" type="text/css" href="../css/styles.css">
<body>
<div class="background-image"></div>
<div class="container" id="app">
    <div class="login-form">
        <h2>管理员登录</h2>
        <form>
            <div class="form-group">
                <label class="username-label">昵称:</label>
                <input type="text" v-model="aname" id="aname" name="aname" placeholder="请输入昵称" required>
            </div>
            <div class="form-group">
                <label class="username-label">密码:</label>
                <input type="password"  v-model="pwd" id="pwd" name="pwd" required placeholder="请输入密码" autocomplete="off">
            </div>
            <button class="login-button" type="button" @click="find">登录</button>
        </form>
    </div>
</div>
<script src="../js/jquery-3.4.1.min.js"></script>
<script src="../js/vue.js"></script>
<script src="../js/axios.js"></script>
<script src="../js/qs.js"></script>
<script>
    let app=new Vue({
        el:"#app",
        data:{
            aname:'',
            pwd:''
        },
        methods:{
            find:function () {
                axios.get("../../admin", {
                    params: {
                        op: 'login',
                        aname: this.aname,
                        pwd: this.pwd
                    }
                }).then(rs => {
                    console.log(rs);
                    if (rs.data =="success") {
                        location.href = 'index.html';
                    } else {
                        alert('登录失败!!');
                    }
                });

            }
        }
    });
</script>
</body>
</html>